/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package replica;

import java.util.concurrent.ArrayBlockingQueue;
import replica.transaction.TransactionStatus;

/**
 *
 * @author Ale
 */
public class PendingTransactionStatusQueue {
    
    
   public static final int size=10;
    
    ArrayBlockingQueue<TransactionStatus> statuses=new ArrayBlockingQueue<TransactionStatus>(size);
    
    public synchronized void add(TransactionStatus status)
    {
        statuses.add(status);
    }
    
    /**
     * Retrieves and removes the head of this queue or returns null if it is empty
     * @return 
     */
    public synchronized TransactionStatus poll()
    {
        return statuses.poll();
    }
    
    public synchronized boolean isEmpty()
    {
        return statuses.isEmpty();
    }
    
    
}
